<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="resource/js/jquery-3.2.1.js"></script>
</head>
<body>
<script type="text/javascript">
	function toPage(pageNum){
		$("[name=pageNum]").val(pageNum);
		$("form").submit();
	}
	function goPage(){
		var pageNum=$("#pageNum").val();
		var pageNums=/^\d+$/;
		if (!pageNums.test(pageNum)) {
			alert("输入的值必须是正整数");
			return false;
		}
		var pages=${info.pages}
		if (pageNum>pages) {
			alert("输入的页数不能大于最大页数");
			return false;
		}
		$("[name=pageNum]").val(pageNum);
		$("form").submit();
	}
	 function qx(thiz){
		$("[name=ck]").attr("checked",thiz.checked);
	} 
</script>
<form action="list" method="post">
	<input type="hidden" name="pageNum">
	影片名称<input type="text" name="name" value="${mo.name }">
	导演<input type="text" name="author" value="${mo.author }">
	<input type="submit" value="搜索">
</form>
<table>
	<tr>
		<th><input type="checkbox" onclick="qx(this)"></th>
		<th>影片名</th>
		<th>导演</th>
		<th>票价</th>
		<th>上映时间</th>
		<th>时长</th>
		<th>类型</th>
		<th>年代</th>
		<th>区域</th>
		<th>状态</th>
		<th>操作</th>
	</tr>

<c:forEach items="${info.list }" var="c">
	<tr>
		<td><input type="checkbox" value="${c.id }" name="ck"></td>
		<td>${c.name }</td>
		<td>${c.author }</td>
		<td>${c.price }</td>
		<td>
			<fmt:formatDate value="${c.upTime }" pattern="yyyy-MM-dd"/>
		</td>
		<td></td>
		<td>${c.type.coal }</td>
		<td>
			<fmt:formatDate value="${c.creatTime }" pattern="yyyy-MM-dd"/>
		</td>
		<td>${c.area }</td>
		<td>${c.status }</td>
	</tr>
</c:forEach>
<tr>
	<td colspan="22">
		当前${info.pageNum }/共${info.pages },
		<c:forEach items="${info.navigatepageNums }" var="pageNum">
			<input type="button" value="${pageNum }" onclick="toPage(${pageNum})">
		</c:forEach>
		第<input type="text" id="pageNum" value="${info.pageNum }" style="width: 20px;">页
		<input type="button" value="go" onclick="goPage()">
	</td>
</tr>
</table>
</body>
</html>